<?php
/*
    GUMUD is Extensible Web-based Multi-User Dungeon Software.

    Copyright (C) 2013  White Rabbit

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
$itt['$varkey']['config']['com-front'] = getLocalConfig($itt,$varkey,"com-front");
if(!isset($_POST['token']) or ($_POST['token'] != $itt['$varkey']['$token'])) { $_SESSION['error'] = "There was a problem processing your request. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
if(strlen($_POST['fptitle']) > 255) {$_SESSION['error'] = "Welcome title exceeds maxium length. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
if(strlen($_POST['fwtitle']) > 255) {$_SESSION['error'] = "Inspirational title exceeds maxium length. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
if(strlen($_POST['fpcontent']) > 128000) {$_SESSION['error'] = "Welcome body text exceeds maxium length. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
if(strlen($_POST['fwcontent']) > 128000) {$_SESSION['error'] = "Inspirational body text exceeds maxium length. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
if(strlen($_POST['fncontent']) > 128000) {$_SESSION['error'] = "Content body text exceeds maxium length. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
$itt['$varkey']['com-front']['temp'][0] = FALSE;
$itt['$varkey']['com-front']['result'][0] = myquery($itt,$varkey,"UPDATE `".$itt['$varkey']['db']['prefix']."config` SET `config-text-value` = '".mysimpletext($_POST['fptitle'],$itt['$varkey'])."'  WHERE (`config-object-name` = 'com-front' and `config-key-1` = 'welcome' and `config-key-2` = 'title')");
if($itt['$varkey']['com-front']['result'][0] == TRUE) {
	$itt['$varkey']['com-front']['result'][1] = myquery($itt,$varkey,"UPDATE `".$itt['$varkey']['db']['prefix']."config` SET `config-text-value` = '".mysimpletext($_POST['fpcontent'],$itt['$varkey'])."'  WHERE (`config-object-name` = 'com-front' and `config-key-1` = 'welcome' and `config-key-2` = 'content')");
	if($itt['$varkey']['com-front']['result'][1] == TRUE) {
		$itt['$varkey']['com-front']['result'][2] = myquery($itt,$varkey,"UPDATE `".$itt['$varkey']['db']['prefix']."config` SET `config-text-value` = '".mysimpletext($_POST['fwtitle'],$itt['$varkey'])."'  WHERE (`config-object-name` = 'com-front' and `config-key-1` = 'promise' and `config-key-2` = 'title')");
	
		if($itt['$varkey']['com-front']['result'][2] == TRUE) {
			$itt['$varkey']['com-front']['result'][3] = myquery($itt,$varkey,"UPDATE `".$itt['$varkey']['db']['prefix']."config` SET `config-text-value` = '".mysimpletext($_POST['fwcontent'],$itt['$varkey'])."'  WHERE (`config-object-name` = 'com-front' and `config-key-1` = 'promise' and `config-key-2` = 'content')");
			if($itt['$varkey']['com-front']['result'][3] == TRUE) {
				$itt['$varkey']['com-front']['result'][4] = myquery($itt,$varkey,"UPDATE `".$itt['$varkey']['db']['prefix']."config` SET `config-text-value` = '".mysimpletext($_POST['fncontent'],$itt['$varkey'])."'  WHERE (`config-object-name` = 'com-content' and `config-key-1` = 'front' and `config-key-2` = 'description' and `config-key-3` = 'content' )");
			}
			else { $_SESSION['error'] = "There was a problem processing your request. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
		}
		else { $_SESSION['error'] = "There was a problem processing your request. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
	}
	else { $_SESSION['error'] = "There was a problem processing your request. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
}
else { $_SESSION['error'] = "There was a problem processing your request. Please contact the website administrators if problem persists"; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die(); }
$_SESSION['sysmessage'] = "Changes made successfully."; header("location: ".$itt['$varkey']['master']['site']['path']['http']."index.php"); die();
?>
